@include('Admin.public.head')
<style>
    .am-btn-toolbar
    {
        margin-top: 5px;
    }
    #credit2_see a
    {
        background: #e4a25e;
        border: 1px solid #e4a25e;
    }
    #my-popups_credit2
    {
        overflow: auto;
    }
	#my-popups
	{
	    overflow: auto;
	}
    #my-popup2 {
        max-height: 490px;}
</style>
<body>
@include('Admin.public.menu')
<div class=" admin-content" id="app">
    {{ csrf_field() }}
    <div class="daohang">

    </div>
    <!--模态框-->
    <div class="am-modal am-modal-no-btn" tabindex="-1" id="my-popup">
        <div class="am-modal-dialog" style="overflow: auto;">
            <div class="am-modal-hd">订单详情
                <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
            </div>

            <table class="am-table am-table-bordered am-table-striped am-table-compact">
                <thead>
                <tr>
                    <td>商品名称</td>
                    <td>商品规格</td>
                    <td>商品价格</td>
                    <td>数量</td>
                    <td>购买时间</td>
                    {{--<td>操作</td>--}}
                </tr>
                </thead>

                <tbody>
                <tr v-for="val,index in orderDetail" class="am-active">
                    <td>@{{ val.goodsname }}</td>
                    <td>@{{ val.specs }}</td>
                    <td>@{{ val.price }}</td>
                    <td>@{{ val.number}}</td>
                    <td>@{{ val.createtime}}</td>
                </tr>
                </tbody>
            </table>
            <!--直商城-->
            <div class="am-popup-bd">
                <div class="am-g" show="orderData.ordertype == 1">
                    <div class="am-u-md-8 am-u-sm-centered" style="color: red;">
                        @{{ orderData.mall_num }}
                    </div>
                </div>

                <!--确认收货-->
                <div class="am-g" v-show="orderData.status == 1">
                    <h3>填写快递信息</h3>
                    <div class="am-u-md-8 am-u-sm-centered">
                        <form class="am-form">
                            <fieldset class="am-form-set">
                                <input type="text" placeholder="快递名称" v-model="orderStatus.expressage">
                                <input type="text" placeholder="快递单号" v-model="orderStatus.courier_number">
                                <input type="text" placeholder="备注" v-model="orderStatus.remark">
                            </fieldset>
                            <button type="button" class="am-btn am-btn-primary am-btn-block"
                                    v-on:click="affirmShipments(orderData.id)">确认发货
                            </button>
                        </form>
                    </div>
                </div>
                <!--确认收货-->
                <div class="am-g" v-show="orderData.status == 2">
                    <div class="am-u-md-8 am-u-sm-centered">
                        <form class="am-form">
                            <button type="button" class="am-btn am-btn-primary am-btn-block"
                                    v-on:click="affirmReceiving(orderData.id)">确认收货
                            </button>
                        </form>
                    </div>
                </div>

                <!--订单已完成-->
                <div class="am-g" v-show="orderData.status == 3">
                    <div class="am-u-md-8 am-u-sm-centered">
                        <form class="am-form">
                            <button type="button" class="am-btn am-btn-primary am-btn-block">交易完成</button>
                        </form>
                    </div>
                </div>

            </div>

        </div>
    </div>

	<div class="am-popup am-popup-inner" id="my-popup1">
	    <div class="am-popup-hd">
	        <h4 class="am-popup-title">复投份额分红</h4>
	        <span data-am-modal-close
	              class="am-close">&times;</span>
	    </div>
	    <div class="am-popup-bd">
	        <form class="am-form">
	            <div class="am-form-group am-cf">
	                <label class="sr-only" >分红总金额</label>
	                <div class="you">
	                    <input type="number" v-model='money'  v-on:blur="newbonus()" class="am-form-field"  placeholder="请输入金额">
	                </div>
	            </div>
				<span class="am-form-group am-cf" style="font-weight: bold;">总分红人数：</span><span style="color: red;">@{{count}}</span>
				<div class="am-form-group am-cf" >
				    <label class="sr-only" for="district1" >单份金额</label>
				    <div class="you">
						 <input class="am-form-field" v-model='pre'  disabled="disabled" placeholder="">
				    </div>
				</div>
				<div class="am-form-group am-cf">
				    <label class="sr-only" for="district1" >分红备注</label>
				    <div class="you">
				        <input v-model='explain'  class="am-form-field"  placeholder="请输入备注">
				    </div>
				</div>

	            <div class="am-text-center" style="margin-top: 20px ">
	                <a type="button" v-on:click="new_bonus()" class="am-btn am-btn-primary">提交</a>
	            </div>
	        </form>
	    </div>
	</div>

    <!-- 新人专区手动分红弹窗 -->
	<div class="am-popup am-popup-inner" id="my-popup2">
	    <div class="am-popup-hd">
	        <h4 class="am-popup-title">贡献值预分红</h4>
	        <span data-am-modal-close
	              class="am-close">&times;</span>
	    </div>
	    <div class="am-popup-bd">
	        <form class="am-form">
	            <div class="am-form-group am-cf">
	                <label class="sr-only" >分红总金额</label>
	                <div class="you">
	                    <input type="number" v-model='money'  v-on:blur="resalebonus()" class="am-form-field"  placeholder="请输入金额">
	                </div>
	            </div>
				<span class="am-form-group am-cf" style="font-weight: bold;">参与分红人数：@{{count}}</span>
                <div class="am-form-group am-cf" >
                    <label class="sr-only" for="district1" >系统总份额：</label>
                    <div class="you">
                        <input class="am-form-field" v-model='total'  disabled="disabled" placeholder="">
                    </div>
                </div>
				<div class="am-form-group am-cf" >
				    <label class="sr-only" for="district1" >单份金额</label>
				    <div class="you">
						 <input class="am-form-field" v-model='pre'  disabled="disabled" placeholder="">
				    </div>
				</div>
				<div class="am-form-group am-cf">
				    <label class="sr-only" for="district1" >分红备注</label>
				    <div class="you">
				        <input  class="am-form-field" v-model='explain'  placeholder="请输入备注">
				    </div>
				</div>
	
	            <div class="am-text-center" style="margin-top: 20px ">
	                <a type="button" v-on:click="resale_bonus()" class="am-btn am-btn-primary">提交</a>
	            </div>
	        </form>
	    </div>
	</div>

	<div class="am-popup am-popup-inner" id="my-popup3">
	    <div class="am-popup-hd">
	        <h4 class="am-popup-title">团队业绩份额预分红</h4>
	        <span data-am-modal-close
	              class="am-close">&times;</span>
	    </div>
	    <div class="am-popup-bd">
	        <form class="am-form">
	            <div class="am-form-group am-cf">
	                <label class="sr-only" >分红总金额</label>
	                <div class="you">
	                    <input type="number"  v-on:blur="teambonus()" v-model='money' class="am-form-field"  placeholder="请输入金额">
	                </div>
	            </div>
				<span class="am-form-group am-cf" style="font-weight: bold;">总分红人数：@{{count}}</span>
                <div class="am-form-group am-cf" >
                    <label class="sr-only" for="district1" >总份额</label>
                    <div class="you">
                        <input class="am-form-field" v-model='total_num'  disabled="disabled" placeholder="">
                    </div>
                </div>
				<div class="am-form-group am-cf" >
				    <label class="sr-only" for="district1" >单份金额</label>
				    <div class="you">
						 <input class="am-form-field" v-model='pre'  disabled="disabled" placeholder="">
				    </div>
				</div>
				<div class="am-form-group am-cf">
				    <label class="sr-only" for="district1" >分红备注</label>
				    <div class="you">
				        <input  class="am-form-field" v-model='explain'  placeholder="请输入备注">
				    </div>
				</div>

	            <div class="am-text-center" style="margin-top: 20px ">
	                <a type="button" v-on:click="team_bonus()" class="am-btn am-btn-primary">提交</a>
	            </div>
	        </form>
	    </div>
	</div>

    <div class="am-modal am-modal-no-btn" tabindex="-1" id="my-popups_credit2">
        <div class="am-modal-dialog">
            <div class="am-modal-hd">订单之前收益会员奖励币数据详情
                <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
            </div>

            <table class="am-table am-table-bordered am-table-striped am-table-compact">
                <thead>
                <tr>
                    <td>会员账号</td>
                    <td>会员姓名</td>
                    <td>电子积分</td>
                    <td>奖励积分</td>
					<td>复销积分</td>
                   <!-- <td>积分</td>
                    <td>代金券</td> -->
                </tr>
                </thead>
                <tbody>
                <tr v-for="val,index in Credit2Detail" class="am-active">
                    <td>@{{ val.name }}</td>
                    <td>@{{ val.user_name }}</td>
                    <td>@{{ val.credit1 }}</td>
                    <td>@{{ val.credit2 }}</td>
					<td>@{{ val.credit5 }}</td>
                   <!-- <td>@{{ val.credit4 }}</td>
                    <td>@{{ val.voucher }}</td> -->
                </tr>
                </tbody>
            </table>
        </div>
    </div>


    <div class="admin-biaogelist">
        <div class="listbiaoti am-cf">
            <ul class="am-icon-flag on"> 订单列表</ul>
            <dl class="am-icon-home" style="float: right;">当前位置： 首页 > <a href="#">订单列表</a></dl>
            <!--这里打开的是新页面-->
        </div>
        <div class="am-btn-toolbars am-btn-toolbar am-kg am-cf">
            <ul>
                

                <li>
                    <div class="block">
                        <el-date-picker
                                v-model="keyword.createtime"
                                type="datetimerange"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                range-separator="~"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期">
                        </el-date-picker>
                    </div>
                </li>

                <li>
                    <template>
                        <el-select v-model="keyword.status" placeholder="订单状态">
                            <el-option
                                    size="medium"
                                    v-for="item in options"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </template>
                </li>
                <li>
                    <el-input v-model="keyword.keyword" class="keywords" placeholder="关键词搜索"></el-input>
                </li>
                <li>
                    <el-button type="primary" v-on:click="changeClick()">搜索</el-button>
                </li>
                {{--<li> <el-button type="success" ><a href="/admin/members/exportUser">导出</a></el-button></li>--}}
               <li>
                    <el-button type="success" v-on:click="exportUser()">导出</el-button>
                </li>
                <li>
                    <el-button type="danger" v-on:click="resetOrder()">重置</el-button>
                </li>

                <li>
                    <el-button type="danger" data-am-modal="{target: '#my-popup2'}">复购贡献值分红</el-button>
                </li>
                <li>
{{--                    <el-button type="danger"  data-am-modal="{target: '#my-popup3'}">团队业绩份额分红</el-button>--}}
                </li>
                <li>
{{--                    <el-button type="danger" data-am-modal="{target: '#my-popup1'}">复投份额分红</el-button>--}}
                </li>
            </ul>
        </div>

        <form class="am-form am-g">
            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
                <thead>
                <tr class="am-success">
					<!-- <th>ID</th> -->
                    <th>订单来源</th>
                    <th>公司</th>
                    <th>订单编号</th>
                   <th>消费门店编号</th>
                    <th>推荐人</th>
                    <th>订单金额</th>
                    <th>支付情况</th>
                    <th>姓名</th>
                    <th>支付状态</th>
                 <!--   <th>订单状态</th>
                    <th>运费</th> -->
                    <th>收货姓名</th>
                    <th>收货地址</th>
                    <th>收货电话</th>
                    <th>配送方式</th>
                    <th>快递单号</th>
                    <th>备注</th>
                    <th>下单时间</th>
                    <th>支付时间</th>
                    <th>快递时间</th>
                    @can('order-operation')
                        <th width="130px" class="table-set">操作</th>
                @endcan
                <!--权限管理-->
                </tr>
                </thead>
                <tbody>


                <!--Marlin update-->
                <tr v-for="val,index in orderList">

					<!-- <td>@{{val.id}}</td> -->
                    <td>
                        <span v-show="val.ordertype == 1">复销专区</span>
                        <span v-show="val.ordertype == 2">新人专区</span>
                        <span v-show="val.ordertype == 3">特价专区</span>
                    </td>
                    <td>
                        <span v-show="val.company_id != 0">@{{ val.branch_name }}</span>
                        <span v-if="val.stores_name != ''">@{{ val.stores_name }}</span>
                        <span v-else >总公司</span>
                    </td>
                    <td>@{{ val.ordersn }}</td>
                   <td style="color: red;">@{{ val.stores_number }}</td>
                    <td style="color: red;">@{{ val.share_name }}</td>
                    <td>@{{ val.price }}</td>
                    <td>@{{ val.reward_money }}</td>
                    <td>@{{ val.user_name }}</td>
                    <td>
                        <span v-show="val.status == 0" style="color:red;">待付款</span>
                        <span v-show="val.status == 1" style="color:green;">已付款</span>
                        <span v-show="val.status == 2">已发货</span>
                        <span v-show="val.status == 3">交易完成</span>
						<span v-show="val.status == -1">订单取消</span>
                    </td>
                   <!-- <td>
                        <span v-show="val.normal == 0" style="color:red;">非正常</span>
                        <span v-show="val.normal == 1" style="color:red;">正常</span>
                    </td> -->

                    <td>@{{ val.name}}</td>
                    <td>@{{ val.addres}}</td>
                    <td>@{{ val.phone}}</td>
                    <td>
                        <span v-show="val.freight == 1" style="color:blue">自提</span>
                        <span v-show="val.freight == 0" style="color: red">配送</span>
                    </td>
                    <td>@{{ val.courier_number }}</td>
                    <td>@{{ val.remark }}</td>
                    <td class="am-hide-sm-only">@{{ val.createtime }}</td>
                    <td class="am-hide-sm-only">@{{ val.paytime}}</td>
                    <td>@{{ val.couriertime }}</td>
                    @can('order-operation')
                        <td>
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs"
                                     data-am-modal="{target: '#my-popup',width:1000,height: 1000}">
                                    <a data-am-modal="{target: '#my-popup',height: 300}" v-on:click="detail(val,index)"
                                       class="am-btn am-btn-success">
                                        <span class="am-icon-search" title="查看订单详情"> 查看</span>
                                    </a>
                                    {{--<button class="am-btn am-btn-default am-btn-xs am-text-secondary am-round" data-am-modal="{target: '#my-popups'}" title="修改订单"><span class="am-icon-pencil-square-o"></span></button>--}}

                                    {{--<button class="am-btn am-btn-default am-btn-xs am-text-secondary am-round" data-am-modal="{target: '#my-popups'}" title="确认收货"><span class="am-icon-pencil-square-o"></span></button>--}}
                                </div>
                            </div>

                            <div class="am-btn-toolbar" id="credit2_see">
                                <div class="am-btn-group am-btn-group-xs"
                                     data-am-modal="{target: '#my-popups_credit2',width:1000,height: 1000}">
                                    <a data-am-modal="{target: '#my-popups_credit2',height: 300}" v-on:click="details(val.id,index)"
                                       class="am-btn am-btn-success">
                                        <span class="am-icon-search" title="订单之前奖励币数据">积分查看</span>
                                    </a>
                                </div>
                            </div>


                            <div class="am-btn-toolbar" v-if="val.ordertype == 4">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a  v-on:click="resetPay(val.uid,val.ordersn)"
                                        class="am-btn am-btn-danger">
                                        <span  title="查看订单详情"> 撤回订单</span>
                                    </a>
                                    {{--<button class="am-btn am-btn-default am-btn-xs am-text-secondary am-round" data-am-modal="{target: '#my-popups'}" title="修改订单"><span class="am-icon-pencil-square-o"></span></button>--}}

                                    {{--<button class="am-btn am-btn-default am-btn-xs am-text-secondary am-round" data-am-modal="{target: '#my-popups'}" title="确认收货"><span class="am-icon-pencil-square-o"></span></button>--}}
                                </div>
                            </div>
                            {{--                        <a class="am-btn am-btn-danger am-radius" v-on:click="resetPay(val.uid)" title="撤回订单">撤回订单</a>--}}
                        </td>
                    @endcan
                </tr>
                </tbody>
            </table>
            总额:<span class="am-badge am-badge-danger am-radius">@{{ total }}</span>
            <!--分页-->
            <ul class="am-pagination am-fr">
                <div class="block">
                    <el-pagination
                            background
                            :page-size="PagesData.per_page"
                            :current-page="PagesData.current_page"
                            layout="total , prev, pager, next"
                            :total="PagesData.total"
                            @prev-click="changeClick"
                            @next-click="changeClick"
                            @current-change="changeClick">
                    </el-pagination>
                </div>
            </ul>
        </form>
    </div>
</div>
</div>
<script src="{{ URL::asset('js/admin/amazeui.min.js') }}"></script>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            orderType: [{
                value: '2',
                label: '新人专区'
            },
			{
                value: '3',
                label: '特价专区'
            }, 
			{
                value: '1',
                label: '复销专区'
            }],
            options: [{
                value: '0',
                label: '待付款'
            }, {
                value: '1',
                label: '已付款'
            }, {
                value: '2',
                label: '已发货'
            }, {
                value: '3',
                label: '已完成'
            },
			{
			    value: '-1',
			    label: '订单取消'
			}],
            total: '',
            explain:'',
            money:0,
            pre:0,
            count:0,
            total_num:0,
            pickerOptions2: {
                shortcuts: [{
                    text: '最近一周',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近一个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近三个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                        picker.$emit('pick', [start, end]);
                    }
                }]
            },
            orderData: {
                'id': '',
                'status': '',
                'mall_num': ''
            },
            orderList: [], //订单列表
            orderDetail: [],//订单详情
            Credit2Detail:[],//会员奖励币详情
            //详情地址
            addresData: {
                'name': '',
                'province': '',
                'city': '',
                'district': '',
                'address': '',
            },
            //确认发货
            orderStatus: {
                expressage: '',
                courier_number: '',
                remark: '',
                ordertype: ''
            },
            PagesData: [],//分页
            pase: '',
            //模态框
            pas: {
                // confirmPassword:'',
            },
            keyword: { //关键字搜索
                ordertype: '',
                createtime: '',
                status: '',
                keyword: '',
            },
            index: '', //数组下标
        },
        //事件
        methods: {
			formatDateTime:function (timeStamp) {
			    var date = new Date();
			    date.setTime(timeStamp * 1000);
			    var y = date.getFullYear();
			    var m = date.getMonth() + 1;
			    m = m < 10 ? ('0' + m) : m;
			    var d = date.getDate();
			    d = d < 10 ? ('0' + d) : d;
			    var h = date.getHours();
			    h = h < 10 ? ('0' + h) : h;
			    var minute = date.getMinutes();
			    var second = date.getSeconds();
			    minute = minute < 10 ? ('0' + minute) : minute;
			    second = second < 10 ? ('0' + second) : second;
			    return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;
			},
            //撤回订单
            resetPay: function (id,ordersn) {
                layer.confirm('确认撤回订单？', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    $.post("/admin/order/cancelOrderMoney", {
                        '_token': '{{csrf_token()}}',
                        uid: id,
                        ordersn:ordersn
                    }, function (res) {
                        if (res.code) {
                            app.initialize()
                            layer.msg(res.data, {time: 500}, function () {
                            }, 500);
                        } else {
                            layer.msg(res.data);
                        }
                    });
                })
            },
            //选择当前页
            new_bonus:function(){
                $.post("/admin/order/consumption", {
                        '_token': '{{csrf_token()}}',
                        class:'new_bonus',
                        money: app.money,
                        explain: app.explain,
                        submit:1
                    }, function (res) {
                    if (res.code) {
                        app.initialize()
                        layer.msg(res.data, {time: 500}, function () {
                        }, 500);
                        window.location.href = "/admin/order/index";
                    } else {
                        layer.msg(res.data);
                    }
                    });
            },
            newbonus:function(){
                $.post("/admin/order/consumption", {
                        '_token': '{{csrf_token()}}',
                        class:'new_bonus',
                        money: app.money,
                        submit:0
                    }, function (res) {
                    if (res.code) {
                        app.pre = res.pre;
                        app.count = res.count;
                    } else {
                        layer.msg(res.data);
                    }

                    });
            },
            resale_bonus:function(){
                $.post("/admin/order/consumption", {
                        '_token': '{{csrf_token()}}',
                        class:'resale_bonus',
                        money: app.money,
                        explain: app.explain,
                        submit:1
                    }, function (res) {
                    if (res.code) {
                        app.initialize()
                        layer.msg(res.data, {time: 500}, function () {
                        }, 500);
                        window.location.href = "/admin/order/index";
                    } else {
                        layer.msg(res.data);
                    }
                    });
            },
            resalebonus:function(){
                $.post("/admin/order/consumption", {
                        '_token': '{{csrf_token()}}',
                        class:'resale_bonus',
                        money: app.money,
                        submit:0
                    }, function (res) {
                    if (res.code) {
                        app.pre = res.pre;
                        app.count = res.count;
                        app.total = res.total;
                    } else {
                        layer.msg(res.data);
                    }
                    });
            },
            team_bonus:function(){
                $.post("/admin/order/consumption", {
                        '_token': '{{csrf_token()}}',
                        class:'team_bonus',
                        money: app.money,
                        explain: app.explain,
                        submit:1
                    }, function (res) {
                    if (res.code) {
                        app.initialize()
                        layer.msg(res.data, {time: 500}, function () {
                        }, 500);
                        window.location.href = "/admin/order/index";
                    } else {
                        layer.msg(res.data);
                    }
                    });
            },
            teambonus:function(){
                $.post("/admin/order/consumption", {
                        '_token': '{{csrf_token()}}',
                        class:'team_bonus',
                        money: app.money,
                        submit:0
                    }, function (res) {
                    if (res.code) {
                        app.pre = res.pre;
                        app.count = res.count;
                        app.total_num = res.total_num;
                    } else {
                        layer.msg(res.data);
                    }
                    });
            },
            changeClick: function (e) {
                var rico = this
                $.get("/admin/order/order", {
                    '_token': '{{csrf_token()}}',
                    class: 'select',
                    page: e,
                    keyword: app.keyword
                }, function (res) {
                    if (res.code) {
                        app.orderList = res.data.data
						for(var i=0;app.orderList.length>i;i++){
						    app.orderList[i].paytime = rico.formatDateTime(app.orderList[i].paytime)
						}
                        app.total = res.total;
                        app.PagesData = res.data
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            initialize: function () {
				var rico = this
                $.post("/admin/order/order", {'_token': '{{csrf_token()}}', class: 'select'}, function (res) {
                    if (res.code) {
                        app.orderList = res.data.data;
                        app.total = res.total;
						for(var i=0;app.orderList.length>i;i++){
						    app.orderList[i].paytime = rico.formatDateTime(app.orderList[i].paytime)
						}
                        app.PagesData = res.data;
                        app.pase = res.data.current_page;
                    } else {
                        layer.msg(res.data);
                    }
                });

            },
            //订单详情
            detail: function (id, index) {
                app.index = index;
                $.post("/admin/order/order", {'_token': '{{csrf_token()}}', class: 'detail', id: id}, function (res) {
                    if (res.code) {
                        app.orderDetail = res.data;
                        app.orderData.id = res.orderData.id;
                        app.orderData.status = res.orderData.status;
                        app.orderData.mall_num = res.orderData.mall_num;
                        app.orderData.ordertype = res.orderData.ordertype;
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            //会员奖励币详情
            details: function (id, index) {
                app.index = index;
                $.post("/admin/order/order", {'_token': '{{csrf_token()}}', class: 'credit2Details', id: id}, function (res) {
                    if (res.code) {
                        app.Credit2Detail = res.data;
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            //确认发货
            affirmShipments: function (id) {
                $.post("/admin/order/order", {
                    '_token': '{{csrf_token()}}',
                    class: 'affirmShipments',
                    id: id,
                    orderStatus: app.orderStatus
                }, function (res) {
                    if (res.code) {
                        $("#my-popup").modal("close");
                        layer.msg(res.data);
                        var i = app.index;
                        app.orderList[i].status = 2
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            //确认收货
            affirmReceiving: function (id) {
                $.post("/admin/order/order", {
                    '_token': '{{csrf_token()}}',
                    class: 'affirmReceiving',
                    id: id
                }, function (res) {
                    if (res.code) {
                        $("#my-popup").modal("close");
                        layer.msg(res.data);
                        var i = app.index;
                        app.orderList[i].status = 2
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            //导出
            exportUser: function () {
                location.href = "/admin/order/exportOrder?ordertype=" + app.keyword.ordertype + '&createtime=' + app.keyword.createtime + '&keyword=' + app.keyword.keyword+'&status=' + app.keyword.status + '&stores=2';
            },
            //重置
            resetOrder: function () {

                location.reload();
            }

        },
        //自动执行
        mounted: function () {
            this.initialize();
        },
    })
</script>
<!--<![endif]-->
@include('Admin.public.foot')

